package com.mt.sdk.ble.model;

public class BLEBaseAction {
	private ActionStatues statues = ActionStatues.WAITTING;

	private ActionType actiontype = ActionType.UNKNOW;
	protected Option option;
	// 写特征值数据
	public BLEBaseAction(ActionType type, Option option) {
		this.actiontype = type;
		this.option = option;
	}

	// 操作类型
	public static enum ActionType {
		UNKNOW, READCHACT, // 读特征值
		WRITECHACT, // 写特征值
		READRSSI, // 读取RSSI
		WRITEDESCRIPTOR, // 写Descriptor
		READDESCRIPTOR, // 读Descriptor
		
		WRITECHACTWITHACK, // 包括等待回复
		
		SENDBIGDATAS,  // 发送大数据
	}

	// 设置参数
	public static class Option {
		private int timeout = 0;
		private int perlenght = 20;
		private int waittime = 0;

		public Option(int timeout) {
			this.timeout = timeout;
		}

		public int getTimeout() {
			return timeout;
		}

		public void setTimeout(int timeout) {
			this.timeout = timeout;
		}

		public int getPerlenght() {
			return perlenght;
		}

		public void setPerlenght(int perlenght) {
			this.perlenght = perlenght;
		}

		public int getWaittime() {
			return waittime;
		}

		public void setWaittime(int waittime) {
			this.waittime = waittime;
		}
	}

	public ActionStatues getStatues() {
		return statues;
	}

	public void setStatues(ActionStatues statues) {
		this.statues = statues;
	}

	public ActionType getActiontype() {
		return actiontype;
	}

	public void setActiontype(ActionType actiontype) {
		this.actiontype = actiontype;
	}

	public Option getOption() {
		return option;
	}

	public void setOption(Option option) {
		this.option = option;
	}
	
	// 运行状态
	public static enum ActionStatues {
		WAITTING, // 等待运行
		RUNING, // 正在运行
		DONE, // 运行完毕
		CANCEL, // 被取消
	}

	// 回调
	public void onStart() {

	}

	public void onSuccess() { // 发送成功

	}

	public void onFail(ErroCode erro) { // 发送失败

	}

	public void onCancel() { // 被取消

	}
}
